<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Promise</title>
</head>
<body>

	<h1>Promise</h1>
	<div><textarea id="output" style="height: 500px; width:200px;"></textarea></div>
	<script type="text/javascript">
		var p1 = new Promise(function (resolve, reject) {
		    setTimeout(resolve, 500, 'P1');
		});
		var p2 = new Promise(function (resolve, reject) {
		    setTimeout(resolve, 600, 'P2');
		});
		Promise.race([p1, p2]).then(function (result) {
		   log(result);
		});
	</script>
</body>
</html>